package com.wyg.blog.service.serviceimpl;

import com.wyg.blog.mapper.RoleMapper;
import com.wyg.blog.model.user.Role;
import com.wyg.blog.service.user.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @description:
 * @author: WYG
 * @time: 2020/6/21 21:22
 */
@Service
public class RoleServiceImpl implements RoleService {
    @Autowired
    RoleMapper roleMapper;

    @Override
    public List<Role> selectRoleByUid(Integer uid) {
        return roleMapper.getRoleByUid(uid);
    }

    @Override
    public Role selectRoleByName(String name) {
        return roleMapper.getRoleByName(name);
    }

    @Override
    public boolean insertRole(Role role) {
        return roleMapper.addRole(role);
    }

    @Override
    public boolean renewRole(Role role) {
        return roleMapper.updateRole(role);
    }

    @Override
    public boolean removeRole(Integer id) {
        return roleMapper.deleteRole(id);
    }
}
